package com.lxl.main;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.ImageIcon;

import java.awt.Color;

import javax.swing.JButton;

import java.awt.Font;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * 登陆界面类（代码生成器自动生成的代码）
 * @author 刘星鹭
 * @Email liuxinglumail@163.com
 * @version 创建时间： 2014年11月10日 上午10:53:48
 */
public class LaunchGame extends JFrame {
	private static final long serialVersionUID = 4754340359340527245L;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LaunchGame frame = new LaunchGame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LaunchGame() {
		setFont(new Font("微软雅黑", Font.PLAIN, 12));
		setAlwaysOnTop(true);
		setResizable(false);
		setTitle("坦克大战");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(
				Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 450 / 2,
				Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 300 / 2,
				450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);

		JPanel panel = new JPanel();
		panel.setBackground(Color.BLACK);
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(null);

		JLabel lblNewLabel = new JLabel("New label");
		lblNewLabel.setIcon(new ImageIcon(LaunchGame.class
				.getResource("..//image//BattleCity.png")));
		lblNewLabel.setBounds(0, 0, 434, 149);
		panel.add(lblNewLabel);

		JButton btnNewButton = new JButton("开始游戏");
		btnNewButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				Game.main(new String[0]);
				dispose();
			}
		});
		btnNewButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		btnNewButton.setFont(new Font("微软雅黑", Font.PLAIN, 12));
		btnNewButton.setBounds(450 / 2 - 134 / 2, 183, 134, 44);
		panel.add(btnNewButton);
	}
}
